﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace C4F.DevKit.Telephony.Controls
{
    [ToolboxItem(true), ToolboxBitmap(typeof(DialPad))]
    public partial class DialPad : UserControl
    {
        #region Properties

        [Browsable(true)]
        public bool Enabled
        {
            get
            {
                return groupBoxDialpad.Enabled;
            }

            set
            {
                groupBoxDialpad.Enabled = value;
            }
        }

        #endregion

        #region Delegates and Events

        public delegate void DigitClickedEventHandler(char buttonChar);

        public event DigitClickedEventHandler DigitClicked;

        public event EventHandler ClearButtonClicked;

        public event EventHandler BackButtonClicked;

        #endregion

        #region Constructors

        public DialPad()
        {
            InitializeComponent();
        }

        #endregion

        #region Event Handlers

        private void btnOne_Click(object sender, EventArgs e)
        {
            DigitClicked('1');
        }

        private void btnTwo_Click(object sender, EventArgs e)
        {
            DigitClicked('2');
        }

        private void btnThree_Click(object sender, EventArgs e)
        {
            DigitClicked('3');
        }

        private void btnFour_Click(object sender, EventArgs e)
        {
            DigitClicked('4');
        }

        private void btnFive_Click(object sender, EventArgs e)
        {
            DigitClicked('5');
        }

        private void btnSix_Click(object sender, EventArgs e)
        {
            DigitClicked('6');
        }

        private void btnSeven_Click(object sender, EventArgs e)
        {
            DigitClicked('7');
        }

        private void btnEight_Click(object sender, EventArgs e)
        {
            DigitClicked('8');
        }

        private void btnNine_Click(object sender, EventArgs e)
        {
            DigitClicked('9');
        }

        private void btnZero_Click(object sender, EventArgs e)
        {
            DigitClicked('0');
        }

        private void btnClearPhoneNumber_Click(object sender, EventArgs e)
        {
            ClearButtonClicked(this, null);
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            BackButtonClicked(this, null);
        }

        #endregion
    }
}
